ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






FUNCTION:  CDate( )

You can determine the expression subtype by using the function VarType( ).


CDate(Date)

The CDate function converts any valid date and time expression to the variant of subtype Date.

The default date output will be of the format:  **/**/** The default time output will be of the format:  **:**:** *M Converted date values can range from January 1, 100 to December 31, 9999

Code:
<% anydate = "June 26, 1943" %>
<% =CDate(anydate) %>

Output:
6/26/43

Code:
<% anydate = #6/26/43# %>
<% =CDate(anydate) %>

Output:
6/26/43

Code:
<% anytime="2:23:59 PM" %>
<% =CDate(anytime) %>

Output:
2:23:59 PM